
#include "devBuzzer.h"

void buzzer_dev_init(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;
  
  RCC_APB2PeriphClockCmd(BUZZER_APB_CLOCK, ENABLE); 
  
  GPIO_InitStructure.GPIO_Pin = BUZZER_PIN;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(BUZZER_PIN_BASE, &GPIO_InitStructure);
	GPIO_SetBits(BUZZER_PIN_BASE, BUZZER_PIN);
}

void buzzer_set(unsigned char ucStat)
{
  if(BUZZER_LOW_LEVEL == ucStat){
    GPIO_ResetBits(BUZZER_PIN_BASE, BUZZER_PIN);
  }else{
    GPIO_SetBits(BUZZER_PIN_BASE, BUZZER_PIN);
  }
}

